//
//  IJIssueCell.m
//  iwjw
//
//  Created by ChenJianjun on 2016/12/14.
//  Copyright © 2016年 iwujwu. All rights reserved.
//

#import "IJIssueCell.h"

@interface IJIssueCell ()

@property (nonatomic, strong) UIImageView *accessView;
@property (nonatomic, strong) UILabel *descLabel;

@end

@implementation IJIssueCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setupSubviews];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews
{
    _accessView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"箭头"]];
    _accessView.contentMode = UIViewContentModeCenter;
    [self.contentView addSubview:_accessView];
    [_accessView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(0);
        make.right.mas_equalTo(-16);
        make.width.mas_equalTo(24);
    }];
    
    _descLabel = [[UILabel alloc] init];
    _descLabel.font = [UIFont systemFontOfSize:12.f];
    _descLabel.textColor = [BLColorConfig darkGrayColor];
    [self.contentView addSubview:_descLabel];
    [_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(0);
        make.trailing.mas_equalTo(_accessView.mas_leading).mas_offset(-8);
        make.leading.mas_equalTo(50);
    }];
    
    self.textLabel.textColor = [BLColorConfig darkGrayColor];
    self.textLabel.font = [UIFont systemFontOfSize:14.f];
    [self.contentView sendSubviewToBack:self.textLabel];
}

- (void)setIssueText:(NSString *)text
{
    self.textLabel.text = text;
}

- (void)setDesc:(NSString *)desc
{
    self.descLabel.text = desc;
}

- (void)setHighlightColor:(UIColor *)color
{
    if (!color) {
        self.descLabel.textColor = [BLColorConfig darkGrayColor];
        return;
    }
    self.descLabel.textColor = color;
}

@end
